package Vista;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import java.awt.event.ActionListener;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class JFrameActuStock extends javax.swing.JFrame {
	private JPanel jPanelActu;
	private JLabel jLblCodIngre;
	private JLabel jLblCantC;
	private JButton jBtnSalir;
	private JLabel jLblStock;
	private JTextField jTxtDesc;
	private JLabel jLblDescrip;
	private JTextField jTxtNombIngre;
	private JLabel jLblNombIngre;
	private JButton jBtnActualizarStock;
	private JButton jBtnBuscar;
	private JTextField jTxtStock;
	private JLabel jLbluni;
	private JTextField jTxtCantC;
	private JTextField jTxtCodIngre;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrameActuStock inst = new JFrameActuStock();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public JFrameActuStock() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("-SGECR- - Registrar Compra de Ingredientes");
			getContentPane().setBackground(new java.awt.Color(93,193,225));
			{
				jPanelActu = new JPanel();
				GroupLayout jPanelActuLayout = new GroupLayout((JComponent)jPanelActu);
				jPanelActu.setLayout(jPanelActuLayout);
				jPanelActu.setBackground(new java.awt.Color(173,216,230));
				{
					jLblCodIngre = new JLabel();
					jLblCodIngre.setText("Cod. Ingrediente: ");
				}
				{
					jLblCantC = new JLabel();
					jLblCantC.setText("Cantidad Comprada: ");
				}
				{
					jLblNombIngre = new JLabel();
					jLblNombIngre.setText("Nombre: ");
				}
				{
					jTxtNombIngre = new JTextField();
				}
				{
					jLblDescrip = new JLabel();
					jLblDescrip.setText("Descripcion:");
				}
				{
					jTxtDesc = new JTextField();
				}
				{
					jLblStock = new JLabel();
					jLblStock.setText("Unidades en Stock:");
				}
				{
					jTxtStock = new JTextField();
				}
				{
					jBtnBuscar = new JButton();
					jBtnBuscar.setText("");
				}
				{
					jTxtCodIngre = new JTextField();
				}
				{
					jTxtCantC = new JTextField();
				}
				{
					jLbluni = new JLabel();
					jLbluni.setText("(Unidades)");
				}
				{
					jBtnActualizarStock = new JButton();
					jBtnActualizarStock.setText("Procesar");
				}
				{
					jBtnSalir = new JButton();
					jBtnSalir.setText("Salir");
				}
					jPanelActuLayout.setHorizontalGroup(jPanelActuLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(jPanelActuLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createSequentialGroup()
					        .addComponent(jLblCodIngre, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					        .addGroup(jPanelActuLayout.createParallelGroup()
					            .addComponent(jTxtCodIngre, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE)
					            .addComponent(jTxtNombIngre, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE)
					            .addComponent(jTxtDesc, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE)))
					    .addGroup(jPanelActuLayout.createSequentialGroup()
					        .addGap(7)
					        .addGroup(jPanelActuLayout.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createSequentialGroup()
					                .addComponent(jLbluni, GroupLayout.PREFERRED_SIZE, 84, GroupLayout.PREFERRED_SIZE)
					                .addGap(57))
					            .addComponent(jLblCantC, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 141, GroupLayout.PREFERRED_SIZE)
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createSequentialGroup()
					                .addComponent(jLblNombIngre, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)
					                .addGap(73))
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createSequentialGroup()
					                .addComponent(jLblDescrip, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE)
					                .addGap(47))
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createSequentialGroup()
					                .addComponent(jLblStock, GroupLayout.PREFERRED_SIZE, 136, GroupLayout.PREFERRED_SIZE)
					                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED))
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createSequentialGroup()
					                .addGap(43)
					                .addComponent(jBtnActualizarStock, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE)
					                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)))
					        .addGap(24)
					        .addGroup(jPanelActuLayout.createParallelGroup()
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createSequentialGroup()
					                .addComponent(jBtnSalir, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE)
					                .addGap(12))
					            .addComponent(jTxtStock, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 79, GroupLayout.PREFERRED_SIZE)
					            .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createSequentialGroup()
					                .addGap(7)
					                .addComponent(jTxtCantC, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE)))
					        .addGap(6)))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addComponent(jBtnBuscar, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(41, Short.MAX_VALUE));
					jPanelActuLayout.setVerticalGroup(jPanelActuLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(jPanelActuLayout.createParallelGroup()
					    .addGroup(GroupLayout.Alignment.LEADING, jPanelActuLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					        .addComponent(jTxtCodIngre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					        .addComponent(jLblCodIngre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					    .addComponent(jBtnBuscar, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addGroup(jPanelActuLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jTxtNombIngre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblNombIngre, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addGroup(jPanelActuLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jTxtDesc, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblDescrip, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(jPanelActuLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jTxtStock, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblStock, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(23)
					.addGroup(jPanelActuLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jTxtCantC, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jLblCantC, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addComponent(jLbluni, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					.addGap(0, 24, Short.MAX_VALUE)
					.addGroup(jPanelActuLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
					    .addComponent(jBtnSalir, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					    .addComponent(jBtnActualizarStock, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
					.addContainerGap(28, 28));
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(25, 25)
				.addComponent(jPanelActu, 0, 263, Short.MAX_VALUE)
				.addContainerGap(41, 41));
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(43, 43)
				.addComponent(jPanelActu, GroupLayout.PREFERRED_SIZE, 359, GroupLayout.PREFERRED_SIZE)
				.addContainerGap(54, Short.MAX_VALUE));
			pack();
			this.setSize(466, 359);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	
	public void addListener(ActionListener actionlistener)
	{
		jBtnActualizarStock.addActionListener(actionlistener);
		jBtnSalir.addActionListener(actionlistener);
		jBtnBuscar.addActionListener(actionlistener);
	}
	
	public void MostrarMensaje(String mensaje)
	{
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public int getCantC()
	{
	 return Integer.parseInt(jTxtCantC.getText());
	 
	}
	public String getCodIngre()
	{
	 return jTxtCodIngre.getText();
	 
	}
	public void setCodIngre(String cod)
	{
		jTxtCodIngre.setText(cod);
	}
	public void setCantC(int cant)
	{
		jTxtCantC.setText(Integer.toString(cant));
	}
	
	public String getNombIngrediente()
	{
	 return jTxtNombIngre.getText();
	}
	public String getDescrip()
	{
	 return jTxtDesc.getText();
	}
	public float getStock()
	{
	 return Float.valueOf(jTxtStock.getText().trim()).floatValue();
	}
	public void setNombIngrediente(String nom)
	{
		jTxtNombIngre.setText(nom);
	}
	public void setDescripcion(String des)
	{
		jTxtDesc.setText(des);
	}
	public void setStock(float sto)
	{
		jTxtStock.setText(String.valueOf(sto));
	}
	
	public void Blanquear()
	{
		jTxtCodIngre.setText("");
		jTxtCantC.setText("");
		jTxtDesc.setText("");
		jTxtNombIngre.setText("");
		jTxtStock.setText("");
	}
	

}
